﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using secondhand.L2busslogic;
using secondhand.L1database;
using secondhand.L3object;


namespace secondhand.L4view
{
    public partial class yonghu_alert_info1 : System.Web.UI.Page
    {
        public static string ID;
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            userOB mydd = new userOB();
            mydd = userBL.Getwordsingle(Session["login"].ToString());
            ID = mydd.ID;
            string user_name = mydd.user_name;
            string pass_word = mydd.pass_word;
            if (mydd.user_name.Trim() == "访问数据库不成功！")
            {
                Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", "<script language='javascript' defer>alert('没有该条记录 ');</script>");
                return;
            }
            if (TextBox1.Text != TextBox2.Text)
            {
                Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", "<script language='javascript' defer>alert('两次输入的密码不一致，请重新输入 ');</script>");
                TextBox1.Text = "";
                TextBox2.Text = "";
                return;
            }
            mydd.user_name = user_name;
            mydd.pass_word = TextBox1.Text;
            mydd.ID = ID;
            if (!userBL.Savemark(mydd))
            {
                Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", "<script language='javascript' defer>alert('修改不成功 ');</script>");
                return;
            }
            else
            {
                Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", "<script language='javascript' defer>alert('您已成功修改，请重新登录!');{location.href='yonghu_login.aspx'}</script>");
                return;
            }
        }
    }
}